package com.slz3.business.module.orderManagement.ordPayDetail.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.orderManagement.ordPayDetail.domain.OrdPayDetail;
import com.slz3.business.module.orderManagement.ordPayDetail.domain.OrdPayDetailFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class OrdPayDetailTransactionalServiceImpl implements OrdPayDetailTransactionalService {

    @Override
    public OrdPayDetail modify(OrdPayDetail ordPayDetailNew) {
        Repositorys.ordPayDetail.test();
        Repositorys.ordPayDetail.save(OrdPayDetailFactory.initBaseFields());
        System.err.println(1/0);
        ordPayDetailNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.ordPayDetail.saveAndFlush(ordPayDetailNew);
    }

    @Override
    public List<OrdPayDetail> batchModify(List<OrdPayDetail> ordPayDetailList) {
        return Repositorys.ordPayDetail.saveAll(ordPayDetailList);
    }
}
